package org.adream.account.util;

import java.lang.management.ManagementFactory;

import com.alibaba.druid.util.StringUtils;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;

/**
 * 获取pid  logback
 * @author sl
 *
 */
public class LogPidConfig extends ClassicConverter {
	
	private static String pid;
	
	static {
		String name = ManagementFactory.getRuntimeMXBean().getName();
		pid = !StringUtils.isEmpty(name) ? name.split("@")[0] : ""; 
	}

	@Override
	public String convert(ILoggingEvent event) {
		return pid;
	}
}